home *** CD-ROM | disk | FTP | other *** search
/ BBS in a Box 7 / BBS in a Box - Macintosh - Volume VII (BBS in a Box) (January 1993).iso / Files / System7 tools / D / DarkSide of the Mac 3.1.1.cpt / DarkSide of the Mac 3.1.1 / FaderShell / Fader.h < prev    next >
Text File  |  1992-06-07  |  3KB  |  97 lines

  1. /*
  2.     DarkSide 3.0 - a 7.0 dependant, system clean expandable screen saver.
  3.     
  4.     copyright © 1990, 1991, 1992 by Tom Dowdy
  5.     All rights reserved.
  6.     
  7.     This header file defines the interface between DarkSide and one of
  8.     its faders.
  9.  
  10. */
  11.  
  12. #ifndef __TYPES__
  13.     #include <Types.h>
  14. #endif
  15. #ifndef __OSUTILS__
  16.     #include <OSUtils.h>
  17. #endif
  18. #ifndef __QUICKDRAW__
  19.     #include <QuickDraw.h>
  20. #endif
  21.  
  22. #define    preflightFader        0
  23. #define initializeFader        1
  24. #define idleFader            2
  25. #define disposeFader        3
  26. #define updateFader            4
  27. #define hitFader            5
  28.  
  29. // info about a screen
  30. typedef struct
  31.     {
  32.     Rect        bounds;                    // bounds of that screen within our window
  33.     Boolean        isColor;                // color or bw/gray
  34.     short        depth;                    // depth in pixels
  35.     GDHandle    theDevice;                // device that goes with that screen
  36.     } ScreenInfo, *ScreenInfoPtr;
  37.     
  38. // storage for the user's settings
  39. #define numShorts    20
  40. #define numStrings    4
  41. typedef struct
  42.     {
  43.     short                theShorts[numShorts];
  44.     Str255                theStrings[numStrings];
  45.     } SettingsBlock, *SettingsPtr;
  46.  
  47. // currently supported options
  48. #define keyAndMouseUnfade        0x0001    // 0 if fader is allowing keystrokes/mouse motion
  49. #define faderRequestsUnfade        0x0002    // 1 if fader wishes to cause an unfade
  50. #define faderRequestsNoWindow     0x0004    // 1 if fader wishes no fade window
  51.  
  52. // info about the machine
  53. typedef struct
  54.     {
  55.     SysEnvRec    theEnvirons;        // info about the machine
  56.     WindowPtr    fadeWindow;            // where the fade is taking place
  57.     Ptr            applicationQD;        // app QuickDraw globals
  58.     long        applicationA5;        // A5 for the application
  59.     long        faderOptions;        // options for the fader to give to DarkSide
  60.     SettingsPtr    faderSettings;        // user's settings for the fader
  61.     DialogPtr    settingsDialog;        // dialog with the settings
  62.     
  63.     short        numScreens;            // how many screens there are
  64.     ScreenInfo    theScreens[20];        // info about each screen
  65.     } MachineInfoRec, *MachineInfoPtr;
  66.     
  67.  
  68.     
  69. OSErr    PreflightFader(MachineInfoPtr machineInfo, long *minTicks, long *maxTicks);
  70. OSErr    InitializeFader(MachineInfoPtr machineInfo);
  71. OSErr    IdleFader(MachineInfoPtr machineInfo);
  72. OSErr    DisposeFader(MachineInfoPtr machineInfo);
  73. OSErr    UpdateFader(MachineInfoPtr machineInfo);
  74. OSErr    HitFader(MachineInfoPtr machineInfo, DialogPtr dPtr, short itemHit, short itemOffset);
  75.  
  76.  
  77. // Utilities
  78. Handle    BestNewHandle(Size theSize);
  79. RgnHandle    BestNewRgn();
  80. short Rnd(long max);
  81. void PlaceRectOnScreen(
  82.     MachineInfoPtr machineInfo,    // give info about the machine here
  83.     short width,                // width of rect, can be 0
  84.     short height,                // height of rect, can be 0
  85.     Rect * placedRect,            // Placed rect is returned here
  86.     Rect * margins,                // margins around screen, can be nil
  87.     short * whichScreen);        // screen index returned here, can be nil
  88.  
  89.  
  90. /* ------------------------------------------------------------------------------------    */
  91. /*    Useful macros for your fader                                                         */
  92. /* ------------------------------------------------------------------------------------    */
  93. #define TopLeft(aRect)    (* (Point *) &(aRect).top)
  94. #define BotRight(aRect)    (* (Point *) &(aRect).bottom)
  95. #define RectWidth(r) (short)((r)->right - (r)->left)
  96. #define RectHeight(r) (short)((r)->bottom - (r)->top)
  97.